package 尚硅谷juc大厂.test13;

import java.util.concurrent.TimeUnit;

public class Test13 {

    public static void main(String[] args) throws InterruptedException {
        /**
         * 被打断的线程并不会立刻停止运行，该线程还是在继续运行的
         */
        Thread t1 = new Thread(() -> {
            for (int i=0;i<=300;i++){
                System.out.println("------i："+i);
            }
            System.out.println("t1.interrupt()方法之后---2："+Thread.currentThread().isInterrupted());
        },"t1");
        t1.start();
        System.out.println("t1线程的中断标识："+t1.isInterrupted());
        TimeUnit.NANOSECONDS.sleep(3);
        t1.interrupt();
        System.out.println("t1.interrupt()方法之后---1："+t1.isInterrupted());
        TimeUnit.SECONDS.sleep(3);
        System.out.println("t1.interrupt()方法之后---3："+t1.isInterrupted());
    }
}
